Diego Celix [Thu, 19 May 2011 11:16:18 +0000 (12:16 +0100)]
gtk/gtkstatusbar: gtk_misc_set_alignment replacing
Replacing the function gtk_misc_set_alignment () with
gtk_widget_set_halign () and gtk_widget_set_valign () in
gtk/gtkstatusbar.c
https://bugzilla.gnome.org/show_bug.cgi?id=650664
Matthias Clasen [Sat, 21 May 2011 13:12:02 +0000 (09:12 -0400)]
Allow NULL permissions
This is useful in some scenarios.
Benjamin Otte [Sat, 21 May 2011 01:41:52 +0000 (03:41 +0200)]
docs: Add missing <row>
Cosimo Cecchi [Tue, 3 May 2011 16:45:08 +0000 (12:45 -0400)]
themingengine: use the text-shadow property to render text shadow
This also avoids hardcoding a shadow for insensitive text in the engine,
as it can now be applied from the theme directly.
https://bugzilla.gnome.org/show_bug.cgi?id=649314
Cosimo Cecchi [Fri, 20 May 2011 20:05:57 +0000 (16:05 -0400)]
shadow: add a method to paint the shadow for a PangoLayout
https://bugzilla.gnome.org/show_bug.cgi?id=649314
Cosimo Cecchi [Fri, 20 May 2011 20:11:41 +0000 (16:11 -0400)]
styleproperties: resolve properties of type GTK_TYPE_SHADOW
https://bugzilla.gnome.org/show_bug.cgi?id=649314
Cosimo Cecchi [Fri, 20 May 2011 20:11:08 +0000 (16:11 -0400)]
styleproperties: add a "text-shadow" style property
And document its use in the CSS parser gtk-doc.
https://bugzilla.gnome.org/show_bug.cgi?id=649314
Cosimo Cecchi [Thu, 19 May 2011 18:48:22 +0000 (14:48 -0400)]
css: add a parser for GTK_TYPE_SHADOW properties
https://bugzilla.gnome.org/show_bug.cgi?id=649314
Cosimo Cecchi [Thu, 19 May 2011 18:47:17 +0000 (14:47 -0400)]
shadow: add a GtkShadow private type
This will be used as a base both for parsing text-shadow and box-shadow
properties. The type is private, as there's no real use in exporting
this in a public API.
https://bugzilla.gnome.org/show_bug.cgi?id=649314
Cosimo Cecchi [Wed, 18 May 2011 21:22:40 +0000 (17:22 -0400)]
assistant: pack the sidebar in a frame instead of an event box
This has mostly two advantages:
- the most obvious one is the theme can render a border around the
sidebar if it wants to.
- we also can avoid hardcoding a container border width for the sidebar,
and just use a padding from the theme. This also allows different
themes to define a different padding, etc.
The drawback is we must draw the background ourselves, but it's easy
enough.
https://bugzilla.gnome.org/show_bug.cgi?id=650530
Cosimo Cecchi [Wed, 18 May 2011 21:21:22 +0000 (17:21 -0400)]
assistant: remove an useless gtk_widget_reset_style() call
It's not needed to call _reset_style() here, as we did not add the
widget to the parent container yet.
https://bugzilla.gnome.org/show_bug.cgi?id=650530
Benjamin Otte [Thu, 19 May 2011 10:51:13 +0000 (12:51 +0200)]
menu: Only realize menu if it isn't realized yet
Lots of code calls gtk_menu_popup() and we don't want to resize the
window needlessly.
In this particular case, keyboard navigation to submenus caused those
submenus to shrink.
Note: I'm not sure this fix doesn't have nasty side effects, as I'm not
a specialist on menu popup code, so if it does, we'll need to revert it.
Until then, let's keep it, it fixes a bug.
Benjamin Otte [Thu, 19 May 2011 00:17:09 +0000 (02:17 +0200)]
tests: Add missing CSS test
Carlos Garnacho [Wed, 18 May 2011 19:50:26 +0000 (21:50 +0200)]
gdk: Document gdk_window_add_filter()+XGenericEvents behavior
Carlos Garnacho [Wed, 18 May 2011 19:32:22 +0000 (21:32 +0200)]
gdk: Get the right filter window for XI2 events
GdkDeviceManagerXI2 now implements GdkEventTranslator::get_window,
retrieving the right window from the contained XIEvent.
Carlos Garnacho [Wed, 18 May 2011 19:24:57 +0000 (21:24 +0200)]
gdk: Add _gdk_x11_event_translator_get_window()
This method can be implemented by event translators so they
return the right window from XGenericEventCookie events, as
ev->xany.window isn't meaningful for these.
GdkEventSource now also uses this to find out the right window
filters to apply.
Carlos Garnacho [Wed, 18 May 2011 17:37:34 +0000 (19:37 +0200)]
gdk: Move XGetEventData() call to GdkEventSource
This function should be called just once across every possible
event translator and GdkFilterFunc that wants to deal with
any cookie event.
Benjamin Otte [Wed, 18 May 2011 19:14:59 +0000 (21:14 +0200)]
mac keys: Add a missing semicolon
Benjamin Otte [Wed, 18 May 2011 19:13:30 +0000 (21:13 +0200)]
keys.css: Remove semicolons at end of rules
This is not CSS conform (it will break resync code after errors for
generic CSS parsers), so I deprecated the support for that semicolon.
Cosimo Cecchi [Wed, 18 May 2011 16:43:10 +0000 (18:43 +0200)]
reftests: Check that inherited properties work
Benjamin Otte [Wed, 18 May 2011 16:37:23 +0000 (18:37 +0200)]
cssprovider: When loading themes, don't pass in an error
We want to parse existing themes as well as possible instead of failing.
And the g_warning() is preserved.
Benjamin Otte [Wed, 18 May 2011 16:35:37 +0000 (18:35 +0200)]
cssprovider: Don't propagate deprecation messages to passed-in error
It's an informative message, don't stop parsing the CSS because of it.
Benjamin Otte [Wed, 18 May 2011 16:32:22 +0000 (18:32 +0200)]
css: Make property parsing functions take a css parser
Instead of reading a string and then passing that in, let the parse
functions use the full power of the parser.
Benjamin Otte [Wed, 18 May 2011 16:03:23 +0000 (18:03 +0200)]
css: Move binding set parsing to strfuncs
Benjamin Otte [Wed, 18 May 2011 11:15:05 +0000 (13:15 +0200)]
cssstringfuncs: Read colors as symbolic colors always
... and then try to resolve them, so static colors get resolved in
advance, just like it was before.
Benjamin Otte [Wed, 18 May 2011 10:58:11 +0000 (12:58 +0200)]
symboliccolor: Allow props == NULL when resolving
If props == NULL in gtk_symbolic_color_resolve(), fail sanely for named
colors. The docs used to say it was not allowed to pass NULL for named
color, but that had problems:
1) You do not know if a color was created that way. This is especially
hard for generic users (like language bindings).
2) It wasn't even true. Colors using other symbolic colors would also
fail when trying to resolve their named colors, but the docs didn't
say so.
And because I want to use the function to resolve static colors early
where possible, I changed things.
Benjamin Otte [Wed, 18 May 2011 03:47:18 +0000 (05:47 +0200)]
cssprovider: Cache if rulesets have inheritable style properties
This provides a huge speedup as we only need to preprocess style
properties when they are indeed inherited. This roughly doubles the
performance of the CSS matcher and brings the time taken by
gtk_css_provider_get_style() from 19% to 7% in my favorite benchmark.
Benjamin Otte [Wed, 18 May 2011 02:36:43 +0000 (04:36 +0200)]
cssprovider: Keep two hash tables per ruleset
One for the style properties, one for the widget style properties.
This way we can make one hash table by pspec which means we don't have
to repeat the pspec lookup.
Benjamin Otte [Wed, 18 May 2011 02:30:51 +0000 (04:30 +0200)]
cssprovider: Add a new setter for rulesets
We now have set-by-pspec (which is used for normal style properties) and
set-by-name (which is used by widget properties).
Benjamin Otte [Wed, 18 May 2011 02:20:05 +0000 (04:20 +0200)]
cssprovider: Refactor handling of rulesets
Keep rulesets as an on-stack/heap structure instead of allocating all
instances separately.
Also, pass a ruleset to the ruleset parser, so we can make the ruleset
parser do lots of fancy things that might be useful for performance.
Benjamin Otte [Tue, 17 May 2011 20:11:50 +0000 (22:11 +0200)]
cssprovider: Refactor code to have a gtk_css_ruleset_matches()
Benjamin Otte [Tue, 17 May 2011 20:04:40 +0000 (22:04 +0200)]
cssprovider: Rename "SelectorStyleInfo" to "Ruleset"
No code changes, just clarification of the name
Benjamin Otte [Tue, 17 May 2011 13:01:59 +0000 (15:01 +0200)]
css: Implement inherit properties
Huge performance hit (slows down things roughly by a factor of 3), but
necessary for CSS conformance and for implementing "inherit" and
percentages.
Benjamin Otte [Mon, 16 May 2011 21:52:19 +0000 (23:52 +0200)]
reftests: Check style property order
Ensure that style properties are read in the correct order, by having a
property twice with vastly different values.
Benjamin Otte [Mon, 16 May 2011 21:37:29 +0000 (23:37 +0200)]
css: Refactor code to do property lookups earlier
We want to ook up the property in the CSS parser, so we can do fancy
things with it. We currently don't but we want to later.
Benjamin Otte [Mon, 16 May 2011 20:46:59 +0000 (22:46 +0200)]
styleproperties: Speed up by not optimizing
g_quark_try_string() takes a lock and then does a hashtable lookup. So
just using a string hash table for properties is faster.
Benjamin Otte [Mon, 16 May 2011 20:35:21 +0000 (22:35 +0200)]
styleproperties: Speed up style_property_lookup()
Use the already existing bsearch version instead of iterating the array
manually.
Benjamin Otte [Mon, 16 May 2011 20:22:42 +0000 (22:22 +0200)]
styleproperties: Use the pspec as the hash table key
The code used the quarked name before, but when we already have the
pspec we want to have a lookup that does not involve quarking. And
lookup is equally fast if we only have the name.
Benjamin Otte [Mon, 16 May 2011 18:20:55 +0000 (20:20 +0200)]
css: Make _gtk_css_selector_matches() take a path length
This will be necessary when handling inherit.
Benjamin Otte [Mon, 16 May 2011 17:54:57 +0000 (19:54 +0200)]
cssprovider: Simplify code
Don't go through an intermediate array when matching styles.
Benjamin Otte [Mon, 16 May 2011 17:42:27 +0000 (19:42 +0200)]
styleproperties: Mark "color" and "font" as inherit
Keeping it identical to CSS 2.1 again
Benjamin Otte [Mon, 16 May 2011 17:31:47 +0000 (19:31 +0200)]
API: Add API to set style properties to be inherit
The API is not used anywhere yet.
Benjamin Otte [Mon, 16 May 2011 15:55:50 +0000 (17:55 +0200)]
cssprovider: Speed up gtk_widget_style_get() property lookups
Previously we got the list of all matching rules and then iterated it to
find the first one that had the property. Now we look while matching
rules, so we don't lookup rules that we don't need.
Benjamin Otte [Mon, 16 May 2011 02:31:07 +0000 (04:31 +0200)]
css: Don't query type for regions
Regions are regions and don't match by type.
Benjamin Otte [Sun, 15 May 2011 11:27:19 +0000 (13:27 +0200)]
reftests: Add a test ensuring selectors don't match children
Previously, the selector "Foo" would not only match Foo widgets, but
also all widgets that are descendants of Foo.
Benjamin Otte [Sun, 15 May 2011 11:24:10 +0000 (13:24 +0200)]
reftests: Add a test for descendant CSS selectors match
In widget hierarchy like "Foo Bar Bar Baz", we want the selector "Foo >
Bar Baz" to match, because it matches the elements 1, 2 and 4.
Previously, the selector only matches the Bar at position 3 and then
failed because it wasn't preceded by a Foo.
Benjamin Otte [Sun, 15 May 2011 11:20:51 +0000 (13:20 +0200)]
reftests: Add a test that checks that * matches regions
Benjamin Otte [Sun, 15 May 2011 11:05:55 +0000 (13:05 +0200)]
reftests: Unset background-image in CSS of test
Otherwise the test screws up when it's set
Benjamin Otte [Sun, 15 May 2011 00:55:22 +0000 (02:55 +0200)]
reftests: Add a check for matching regions only once
Benjamin Otte [Sat, 14 May 2011 23:22:24 +0000 (01:22 +0200)]
tests: Add a test for enum values
Benjamin Otte [Sun, 15 May 2011 13:55:13 +0000 (15:55 +0200)]
css: Raised SYNTAX error when enum value can't be parsed
Benjamin Otte [Sat, 14 May 2011 23:28:17 +0000 (01:28 +0200)]
reftests: Add a test for matching by class
Benjamin Otte [Sat, 14 May 2011 22:34:43 +0000 (00:34 +0200)]
reftests: Add a test for matching by name
Benjamin Otte [Sat, 14 May 2011 11:36:00 +0000 (13:36 +0200)]
reftests: Add a test for matching by subtype
Benjamin Otte [Sat, 14 May 2011 11:35:19 +0000 (13:35 +0200)]
reftests: Add test to check that matching by type works
Benjamin Otte [Sat, 14 May 2011 22:17:04 +0000 (00:17 +0200)]
tests: Add a test to ensure we handle unknown pseudo-classes correctly
1) We want to throw an unknown value
2) We want to skip the whole rule
Benjamin Otte [Sat, 14 May 2011 22:15:25 +0000 (00:15 +0200)]
tests: Add a test for all selector combination
The test contains an error where we complain about a duplicate value for
":hover:hover"
Benjamin Otte [Sat, 14 May 2011 21:54:37 +0000 (23:54 +0200)]
css: No more special code for regions
Just treat regions the same as elements.
Benjamin Otte [Sat, 14 May 2011 11:27:31 +0000 (13:27 +0200)]
css: Rewrite selectors
Selectors now go into their own C file. The new selectors are modeled a
lot closer to the CSS spec. In particular the specificity computation
matches CSS 2.1 exactly.
For details about the why, see also:
http://mail.gnome.org/archives/gtk-devel-list/2011-May/msg00061.html
https://bugzilla.gnome.org/show_bug.cgi?id=649798
Benjamin Otte [Fri, 13 May 2011 14:21:20 +0000 (16:21 +0200)]
cssprovider: Remove a bunch of commented-out code
The code was only kept for reference while writing the new parser, it's
not necessary anhymore.
Benjamin Otte [Fri, 15 Apr 2011 14:21:25 +0000 (16:21 +0200)]
tests: Be more verbose in error messages.
Also, it makes it easier to copy/paste diffs from the message log...
Benjamin Otte [Thu, 14 Apr 2011 19:13:48 +0000 (21:13 +0200)]
tests: Add test that ensures we properly parse the color red
Benjamin Otte [Thu, 14 Apr 2011 15:48:06 +0000 (17:48 +0200)]
tests: Add another parsing test from the css spec
Benjamin Otte [Thu, 14 Apr 2011 15:44:31 +0000 (17:44 +0200)]
tests: Add parsing test from the css spec
Benjamin Otte [Thu, 14 Apr 2011 11:48:06 +0000 (13:48 +0200)]
tests: Make the parser fail without assertions
Use the new g_test_fail() function. This way, the testsuite usually
doesn't crash, but actually finishes.
Benjamin Otte [Thu, 14 Apr 2011 02:47:18 +0000 (04:47 +0200)]
css: Rewrite the parser
Instead of relying on GScanner and its idea of syntax, code up a parser
that obeys the CSS spec.
This also has the great side effect of reporting correct line numbers
and positions.
Also included is a reorganization of the returned error values. Instead
of error values describing what type of syntax error was returned, the
code just returns SYNTAX_ERROR. Other messages exist for when actual
values don't work or when errors shouldn't be fatal due to backwards
compatibility.
Benjamin Otte [Tue, 12 Apr 2011 02:35:22 +0000 (04:35 +0200)]
tests: Add a test for importing nonexistant files
Benjamin Otte [Tue, 12 Apr 2011 02:34:02 +0000 (04:34 +0200)]
tests: Add tests for cyclic imports
Benjamin Otte [Tue, 12 Apr 2011 02:28:30 +0000 (04:28 +0200)]
tests: Add test for recursively importing an identical file
Benjamin Otte [Tue, 12 Apr 2011 02:26:36 +0000 (04:26 +0200)]
cssprovider: Don't hardcode strings anymore
Benjamin Otte [Tue, 12 Apr 2011 02:26:10 +0000 (04:26 +0200)]
cssprovider: Add support for strings
Benjamin Otte [Tue, 12 Apr 2011 01:22:22 +0000 (03:22 +0200)]
cssprovider: Parse strings as identifiers when parsing property values
Benjamin Otte [Tue, 12 Apr 2011 00:50:25 +0000 (02:50 +0200)]
cssprovider: Add recursion checks for @import
This is pretty important, because otherwise recursions cause crashes.
And if you accidentally change your theme to one that crashes on load,
all your gonna SEGV and then on reboot, gdm tries to load the theme...
Benjamin Otte [Tue, 12 Apr 2011 00:06:08 +0000 (02:06 +0200)]
cssprovider: Allow storing the parent stylesheet
Benjamin Otte [Mon, 11 Apr 2011 23:50:07 +0000 (01:50 +0200)]
cssprovider: Don't fail if an import doesn't work
Benjamin Otte [Mon, 11 Apr 2011 23:22:16 +0000 (01:22 +0200)]
cssprovider: Reimplement gtk_css_provider_load_from_path()
Call gtk_css_provider_load_from_file() instead of the internal function.
This has two advantages:
1) It simplifies the code a lot
2) It gets rid of GMappedFile usage. GMappedFile does not work
everywhere, so this is finally portable.
Benjamin Otte [Mon, 11 Apr 2011 23:10:13 +0000 (01:10 +0200)]
cssprovider: Make @import use the new load_internal() func
Benjamin Otte [Mon, 11 Apr 2011 18:08:57 +0000 (20:08 +0200)]
cssprovider: Make load_internal() load the contents
This way, we achieve two things:
1) We can unify file loading to one location
2) We can emit the error from file loading using the parsing-error
signal. This is very useful for @import handling in particular.
Benjamin Otte [Mon, 11 Apr 2011 18:06:39 +0000 (20:06 +0200)]
cssprovider: Introduce gtk_css_provider_take_error_full()
Emits the error without the need for a scanner. Also simplifies
gtk_css_provider_take_error() because we now can assert an available
scanner at all times.
Benjamin Otte [Mon, 11 Apr 2011 17:57:42 +0000 (19:57 +0200)]
cssprovider: More error handling into load_internal()
Now the parsing functions starting at parse_stylesheet() don't have to
care about errors anymore.
Benjamin Otte [Mon, 11 Apr 2011 17:55:34 +0000 (19:55 +0200)]
cssprovider: Add a load_internal function that all loads chain to
Benjamin Otte [Mon, 11 Apr 2011 15:57:50 +0000 (17:57 +0200)]
tests: Order files by name before adding them as tests
Ensures that the order of tests is not dependant on your hard disk.
Benjamin Otte [Mon, 11 Apr 2011 15:30:01 +0000 (17:30 +0200)]
cssprovider: Keep base url in the scanner
And provide a nice function to query it. Simplifies a bunch of code.
Benjamin Otte [Mon, 11 Apr 2011 14:48:00 +0000 (16:48 +0200)]
cssprovider: Move properties to scanner constructor
So we can set them in one place.
Benjamin Otte [Mon, 11 Apr 2011 01:14:23 +0000 (03:14 +0200)]
cssprovider: Don't store scanner in the struct
Instead, create scanners whenever we actually parse stuff.
Benjamin Otte [Mon, 11 Apr 2011 00:37:24 +0000 (02:37 +0200)]
cssprovider: Get rid of gtk_css_provider_reset_parser()
Instead call gtk_css_scanner_reset(). There is nothing else we could
need to do.
Benjamin Otte [Mon, 11 Apr 2011 00:32:26 +0000 (02:32 +0200)]
cssprovider: Keep track of passed in error differently
Instead of having an error member in the CSS provider's private struct,
connect a signal handler when an error is passed in. This has two
advantages:
1) It makes the code clearer as we don't have to keep track of an error
member anywhere.
2) It causes a non-emission of the g_warning() when an error was passed
in, because it only triggers when no signal handlers are connected.
So we get identical behavior to GTK 3.0 where warnings where only
emitted when no error was passed in.
Benjamin Otte [Mon, 11 Apr 2011 00:18:21 +0000 (02:18 +0200)]
cssprovider: Do error handling differently
Instead of aborting a parse whenever we encounter an error, parse to the
end. But if a GError was passed in, reset the provider completely as if
nothing had been parsed.
Benjamin Otte [Sun, 10 Apr 2011 23:51:49 +0000 (01:51 +0200)]
cssprovider: Emit a g_warning() when a css file is erroneous
... and no other error handler is active. See the source code comment
for the reasoning.
Benjamin Otte [Sun, 10 Apr 2011 23:33:26 +0000 (01:33 +0200)]
cssprovider: No need to restore after @import parsing
With the recent changes, this just resets the error, and we don't the
error reset from subfile parsing.
Benjamin Otte [Sun, 10 Apr 2011 23:28:00 +0000 (01:28 +0200)]
cssprovider: Store current properties and selectors in scanner
They don't belong in the css provider
Benjamin Otte [Sun, 10 Apr 2011 23:25:27 +0000 (01:25 +0200)]
cssprovider: Use scanner variable instead of priv->scanner
Benjamin Otte [Sun, 10 Apr 2011 13:22:07 +0000 (15:22 +0200)]
cssprovider: Pass scanner argument explicitly to error functions
Benjamin Otte [Sun, 10 Apr 2011 02:51:55 +0000 (04:51 +0200)]
cssprovider: Update the scope modifying functions
Make them take the scanner as an argument, as that's what gets changed,
not the CssProvider.
Benjamin Otte [Sun, 10 Apr 2011 01:51:43 +0000 (03:51 +0200)]
cssprovider: track state in the scanner
This way, we don't have to do magic copies when we create a new scanner
for a subfile.
Benjamin Otte [Sun, 10 Apr 2011 01:39:52 +0000 (03:39 +0200)]
cssprovider: Add a private structure to the scanner
So far, it's unused
Benjamin Otte [Sun, 10 Apr 2011 01:35:19 +0000 (03:35 +0200)]
cssprovider: Add a custom gtk_css_scanner_destroy() function
So far, it does nothing
Benjamin Otte [Sun, 10 Apr 2011 01:16:04 +0000 (03:16 +0200)]
cssprovider: Pass the scanner explicitly to parse_stylesheet()
This is the first step in decoupling the scanner from the provider.
Benjamin Otte [Sun, 10 Apr 2011 00:20:17 +0000 (02:20 +0200)]
cssprovider: No need to set user data anymore
Benjamin Otte [Sat, 9 Apr 2011 23:53:43 +0000 (01:53 +0200)]
tests: Make css-parser test take files as argument
Takes the css files to be tested as argument and runs with it.